<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: 刘世琪
 * @Date: 2021-01-30 13:41:56
 * @LastEditors: Seven
 * @LastEditTime: 2021-01-30 17:52:58
-->
<template>
    <div>
        <input type="text" v-model="username" placeholder="请输入账号">
        <input type="text" v-model="password" placeholder="请输入密码">
        <input type="text" v-model="phone" placeholder="请输入手机号">
        <input type="text" v-model="role" placeholder="请输入会员等级">
        <input type="text" v-model="money" placeholder="请输入金额">
        <button @click="register">注册</button>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
            username:"",
            password:'',
            phone:'',
            role:"",
            money:0,
            base_url:"http://localhost:8000/"
        }
    },
    methods: {
        register(){
            let params = {
                username:this.username,
                password:this.password,
                phone:this.phone,
                role:this.role,
                money:money
            }
            this.axios.post(this.base_url + "register/",this.qs.stringify(params)).then(res=>{
                console.log(res.data)
                if(res.data.code== 200){
                    alert(res.data.msg)
                    this.$router.push({
                        name:"Login"
                    })
                }else{
                    alert(res.data.msg)
                }
            })
               
        } 
       

    },
    created() {

    }
}
</script>

<style scoped>

</style>
